package com.LeeCode;

/**
 * 6 和 9 组成的最大数字
 */

public class Code1323 {
    public static void main(String[] args) {
        System.out.println(new Code1323().maximum69Number(699));
    }

    public int maximum69Number(int num) {
        String s = Integer.toString(num);
        char[] A = s.toCharArray();
        for (int i = 0; i < A.length; ++i) {
            if (A[i] == '6') {
                A[i] = '9';
                break;
            }
        }
        return Integer.parseInt(new String(A));
    }
}
